function* WeaponGenerator() {
    yield "Katana";
    yield "Wakizashi";
    yield* NinjaGenerator();
    yield "Kusarigama";
}

function* NinjaGenerator() {
    yield "Hattori";
    yield "Yoshi";
}

const weaponsIterator = WeaponGenerator();
let item;
while (!(item = weaponsIterator.next()).done) {
    console.log(item.value)
}

function* IdGenerator() {
    let id = 0;
    while (true) {
        yield ++id;
    }
}

const idIterator = IdGenerator();
const ninja1 = {id: idIterator.next().value};
const ninja2 = {id: idIterator.next().value};
const ninja3 = {id: idIterator.next().value};

console.log(ninja1.id);
console.log(ninja2.id);
console.log(ninja3.id);